package com.cnc.servlet;

import com.cnc.service.CourseDetailService;
import com.cnc.service.Impl.CourseDetailServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/courseDetail")
public class CourseDetailServlet extends BaseServlet {
    CourseDetailService cds=new CourseDetailServiceImpl();
    protected void add(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String data = req.getReader().readLine();
        if (data != null) {
            resp.getWriter().print(cds.add(data));
        }
        //resp.getWriter().print(us.updateUser(req.getReader().readLine()));
    }
    protected void getCourseInfo(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String cid = req.getParameter("cid");
        if(cid!=null) {
            resp.getWriter().print(cds.getInfo(cid));
        }
        //resp.getWriter().print(us.updateUser(req.getReader().readLine()));
    }
}
